// -*- Mode: C++ -*-
#ifndef PATTERN_H
#define PATTERN_H

#include <boost/signals2.hpp>
#include <vector>
#include <string>

class Event;

class Pattern {
public:
     // onChange signal template
     typedef boost::signals2::signal<void (Pattern*, int)> OnChange;

     Pattern(const std::string &name="", int number=-1, int length=0);
     ~Pattern();

     const std::string &name() const;
     void setName(const std::string &name);
     int number();
     void setNumber(int number);

     int length();
     void setLength(int length);
     Event *eventAt(int i);
     void setEventAt(int i, Event *pEvent);
     void zap();
     // slots
     void eventChanged(int num);
     
     // onChange connect function
     boost::signals2::connection onChange(const OnChange::slot_type &callback);

private:
     std::string m_name;
     int m_number;
     std::vector<Event*> m_events;
     // signal to emit when an event's data changes
     OnChange m_onChange;

     void addEvent(Event *pEvent, int i);
};

#endif
